﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;
using System.Collections;


namespace EnumUtils.Extensions
{
  public static class FlagEnumExtensions
  {
    /// <summary>
    /// Bit shifts the flag enum bit pattern leftward.
    /// </summary>
    /// 
    /// <param name="flagEnum">Flag enum instance to bit-shift on (is NOT modified)</param>
    /// 
    /// <param name="timesToShift">The number of times to shift the bit pattern.</param>
    /// 
    /// <returns></returns>
    /// 
    /// <exception cref="ArgumentException">
    /// Thrown when bitPattern is not a Flags enum.
    /// </exception>
      public static TEnum
      BitShiftLeft<TEnum>( this Enum flagEnum, int timesToShift ) {
//LATER: Place all common code contract blocks in their own helper methods, since regression tests on FlagEnumutilities.GetEnuemrator() prove that Code Contracts work all the same across method calls.
        return FlagEnumUtilities.BitShiftLeft((dynamic)flagEnum, timesToShift);
      }

      



    /// <summary>
    /// Bit shifts the flag enum bit pattern rightward.
    /// </summary>
    /// 
    /// <param name="flagEnum"></param>
    /// 
    /// <param name="timesToShift">The number of times to shift the bit pattern.</param>
    /// 
    /// <returns></returns>
    public static TEnum
    BitShiftRight<TEnum>( this Enum flagEnum, int timesToShift ) {
      return FlagEnumUtilities.BitShiftRight((dynamic)flagEnum, timesToShift);
    }




    #region Helper Methods
    #endregion
  }
}
